
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    long long a = 0,h = 0,b = 0,k = 0;
    cin >> a >> h >> b >> k;
    long long res = 0;
    long long n = std::min(h/b,k/a);
    h -= n*b;
    k -= n*a;
    res = n*a + n*b;
    if(h > 0 && k > 0)
    {
        res = res + a + b;
        h -= b;
        k -= a;
    }
    if(h > 0){
        res += a*10;
    }
    if(k > 0){
        res += b*10;
    }
    cout << res;
    return 0;
}